package com.thoughtworks.university.biblioteca;

/**
 * Created by sravanns on 10/06/14.
 */
public class CheckOut {
    private String book_name="";

    public CheckOut(String name)
    {
        book_name=name;

    }

    public boolean doAction() {

        ListBooks catalog=new ListBooks();
        Book book=catalog.is_available_catalog(book_name);
        if(book!=null)
        {
            if(new BibliotecaApp().add(book))
            {
                System.out.println("Thank you! Enjoy the book");
                return true;
            }
            else {
                System.out.println("That book is not available. might be checked out already");
                return false;
            }
        }
        else {
            System.out.println("That book is not available in Library. please consider checking the spelling");
            return false;
        }
    }
}
